package net.dntuan.training.mvc.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

@XmlRootElement
@Entity
@Table(name = "city")
public class City implements Serializable {

    private static final long serialVersionUID = -8211217139859234547L;

    private Long id;
    private String name;
    private String countryCode;
    private String district;
    private Integer population;

    @Id
    @GeneratedValue(generator = "cityIdGenerator")
    @GenericGenerator(name = "cityIdGenerator", strategy = "sequence", parameters = @Parameter(name = "sequence", value = "city_seq"))
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "countrycode")
    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public Integer getPopulation() {
        return population;
    }

    public void setPopulation(Integer population) {
        this.population = population;
    }
}
